class UsersController < ApplicationController
  before_filter :authenticate, :only => [:icon]
  
  def index
    @users = User.find :all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @user }
    end
  end

  def show
    @user = User.find_by_login(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @user }
    end
  end
  
  def icon
    if request.method == :post
      @product_shot = ProductShot.new(params[:product_shot])
      if @product_shot.save
        current_user.update_attributes(:image => @product_shot.public_filename)
        redirect_to "/users/show/#{current_user.login}"
      end
    end
  end
end
